//
//  UILabel+GetWithSize.m
//  bigMall
//
//  Created by LTOVE on 16/7/6.
//  Copyright © 2016年 thinklev. All rights reserved.
//

#import "UILabel+GetWithSize.h"

@implementation UILabel (GetWithSize)

+ (CGFloat)getHeighByWidth:(CGFloat)width title:(NSString *)title font:(UIFont *)font
{
    UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, width, 0)];
    lable.text = title;
    lable.font = font;
    lable.numberOfLines = 0;
    [lable sizeToFit];
    CGFloat heigh = lable.frame.size.height;
    return heigh;
    
}

+(CGFloat)getWidthwithTitle:(NSString *)title font:(UIFont *)font
{
    
    UILabel *label = [[UILabel alloc]init];
    label.text = title;
    label.font = font;
    [label sizeToFit];
    return label.frame.size.width;
}

+ (instancetype)labelWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)color
{
    UILabel *label = [UILabel new];
    label.text = text;
    label.font = font;
    label.textColor = color;
    return label;
}

@end
